package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的回复表 前端控制器
 * </p>
 *
 * @author 老李头儿
 */
@RestController
@RequestMapping("/admin/replies")
@Api(tags = "管理端-评论回复相关接口")
@RequiredArgsConstructor
public class InteractionReplyAdminController {
    private final IInteractionReplyService replyService;

    /**
     * 分页查询回答或评论列表
     *
     * @param replyPageQuery
     */
    @GetMapping("/page")
    @ApiOperation("分页查询回答或评论列表")
    public PageDTO<ReplyVO> pageReply(ReplyPageQuery replyPageQuery) {
        return replyService.pageReply(replyPageQuery,true);
    }


    /**
     * 管理端显示或隐藏评论
     * @param id
     * @param hidden
     */
    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("管理端显示或隐藏评论")
    public void  isHidden(@PathVariable Long id, @PathVariable boolean hidden) {
        replyService.isHidden(id,hidden);
    }
}
